'use strict';
exports.main = async (event, context) => {
	//event为客户端上传的参数
	console.log('event : ', event)
	const styleBgcolor = () => { //随机背景色样式
		let arr = ['bg-primary', 'bg-secondary', 'bg-accent', 'bg-neutral', 'bg-base', 'bg-info',
			'bg-success', 'bg-warning', 'bg-error'
		]
		let index = Math.floor((Math.random() * arr.length));
		return arr[index]
	}
	let newArray=[]
	for (var i = 0; i < 3; i++) {
		newArray.push(styleBgcolor())
	}
	const db = uniCloud.database();
	const dbCmd = db.command
	// let res = await db.collection('my-music-backup').doc(event.id).update({
	let res = await db.collection('my-music-backup').update({
		style_ids: dbCmd.pop()
	})
	//返回数据给客户端
	return res
};
